package com.dstz.demo.rest.controller;

import com.dstz.base.api.aop.annotion.CatchErr;
import com.dstz.base.api.exception.BusinessException;
import com.dstz.base.api.response.impl.ResultMsg;
import com.dstz.base.rest.BaseController;
import com.dstz.demo.core.manager.SzfwbManager;
import com.dstz.demo.core.model.Szfwb;
import com.dstz.form.api.constant.FormStatusCode;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


/**
 * szfwb 控制器类<br/>
 * @author  aschs
 * </pre>
 */
@RestController
@RequestMapping("/sys/szfwb")
public class SzfwbController extends BaseController<Szfwb>{
	@Resource
	SzfwbManager szfwbManager;
	
	@Override
	protected String getModelDesc() {
		return "szfwb";
	}

	@PostMapping("/szfwbByIds/{ids}")
	@CatchErr(write2response = true, value = "收藏服务异常")
	public ResultMsg szclbByIds(@PathVariable(value = "ids", required = false) String[] ids) throws Exception {
		if (ids==null) {
			throw new BusinessException("选择不能为空", FormStatusCode.PARAM_ILLEGAL);
		}
		for(int i=0;i<ids.length;i++){
			Szfwb szfwb=new Szfwb();
			szfwbManager.create(szfwb);
		}
		return getSuccessResult("服务收藏成功！");
	}


}
